	
	package service;

	import java.util.ArrayList;
	import java.util.List;
	import enitys.Grade;
	import Dao.GradeDao;
import Dao.daoimpl.GradeDaoImpl;
	
	public class GradeManagner {
		
			/**
			 * java 单例原理
			 */
			private GradeDao dao = new GradeDaoImpl();
			static private GradeManagner instance = null;
		
			private GradeManagner()
			{
		
			}
		
			static public synchronized GradeManagner getInstance()
			{
					if (instance == null) {
						instance = new GradeManagner();
					}
					return instance;
			}
			
			
			public List<Grade> Allinfo() throws Exception 
			{
				return dao.gradeAllinfo();
			}
			
			
			public List<Grade> persongrade(String name)throws Exception
			{
				
				List<Grade> list= new ArrayList<Grade>();
				list=dao.personGrade(name);
				
				return list;
			}
			
			public boolean Updategrade(Grade grade) throws Exception
			{
				
				return dao.UpdateGrade(grade);

			}
			
			
			public int deleteGrade(int id) throws Exception
			{
				
				
				return dao.deleteGrade(id);
				
			}
			
			
			public boolean addGrade(Grade grade) throws Exception 
			{
				
				boolean flag=false;
				flag=dao.addGrade(grade);
				return flag;
			}
	}
